home *** CD-ROM | disk | FTP | other *** search
/ Aminet 4 / Aminet 4 - November 1994.iso / aminet / dev / obero / oberon_lib.lha / oberon-a / source1.lha / source / Amiga / AmigaGuide.mod next >
Text File  |  1994-08-08  |  13KB  |  421 lines

  1. (**************************************************************************
  2.  
  3.      $RCSfile: AmigaGuide.mod $
  4.   Description: Interface to amigaguide.library
  5.  
  6.    Created by: fjc (Frank Copeland)
  7.     $Revision: 3.2 $
  8.       $Author: fjc $
  9.         $Date: 1994/08/08 01:13:39 $
  10.  
  11.   Includes Release 40.15
  12.  
  13.   (C) Copyright 1990-1993 Commodore-Amiga, Inc.
  14.       All Rights Reserved
  15.  
  16.   Oberon-A Interface Copyright © 1994, Frank Copeland.
  17.   This file is part of the Oberon-A Interface.
  18.   See Oberon-A.doc for conditions of use and distribution.
  19.  
  20. *************************************************************************)
  21.  
  22. MODULE AmigaGuide;
  23.  
  24. (*
  25. ** $C- CaseChk       $I- IndexChk  $L+ LongAdr   $N- NilChk
  26. ** $P- PortableCode  $R- RangeChk  $S- StackChk  $T- TypeChk
  27. ** $V- OvflChk       $Z- ZeroVars
  28. *)
  29.  
  30. IMPORT E := Exec, U := Utility, D := Dos, I := Intuition, SYS := SYSTEM;
  31.  
  32.  
  33. TYPE
  34.  
  35. (**-- Pointer declarations ---------------------------------------------*)
  36.  
  37.   AmigaGuideMsgPtr * = CPOINTER TO AmigaGuideMsg;
  38.   ContextTablePtr * = CPOINTER TO ContextTable;
  39.   NewAmigaGuidePtr * = CPOINTER TO NewAmigaGuide;
  40.   XRefPtr * = CPOINTER TO XRef;
  41.   AmigaGuideHostPtr * = CPOINTER TO AmigaGuideHost;
  42.   MsgPtr * = CPOINTER TO Msg;
  43.   OpFindHostPtr * = CPOINTER TO OpFindHost;
  44.   OpNodeIOPtr * = CPOINTER TO OpNodeIO;
  45.   OpExpungeNodePtr * = CPOINTER TO OpExpungeNode;
  46.  
  47.  
  48. (**-- Library definitions ----------------------------------------------*)
  49.  
  50. CONST
  51.  
  52.   apshToolId       * = 11000;
  53.   startupMsgId     * = apshToolId+1;  (* Startup message *)
  54.   loginToolId      * = apshToolId+2;  (* Login a tool SIPC port *)
  55.   logoutToolId     * = apshToolId+3;  (* Logout a tool SIPC port *)
  56.   shutdownMsgId    * = apshToolId+4;  (* Shutdown message *)
  57.   activateToolId   * = apshToolId+5;  (* Activate tool *)
  58.   deactivateToolId * = apshToolId+6;  (* Deactivate tool *)
  59.   activeToolId     * = apshToolId+7;  (* Tool Active *)
  60.   inactiveToolId   * = apshToolId+8;  (* Tool Inactive *)
  61.   toolStatusId     * = apshToolId+9;  (* Status message *)
  62.   toolCmdId        * = apshToolId+10; (* Tool command message *)
  63.   toolCmdReplyId   * = apshToolId+11; (* Reply to tool command *)
  64.   shutdownToolId   * = apshToolId+12; (* Shutdown tool *)
  65.  
  66. (* Attributes accepted by GetAmigaGuideAttr() *)
  67.   agaDummy         * = U.tagUser;
  68.   agaPath          * = agaDummy+1;
  69.   agaXRefList      * = agaDummy+2;
  70.   agaActivate      * = agaDummy+3;
  71.   agaContext       * = agaDummy+4;
  72.  
  73.   agaHelpGroup     * = agaDummy+5;    (* E.ULONG: Unique identifier *)
  74.  
  75.   agaReserved1     * = agaDummy+6;
  76.   agaReserved2     * = agaDummy+7;
  77.   agaReserved3     * = agaDummy+8;
  78.  
  79.   agaARexxPort     * = agaDummy+9;
  80.     (* E.MsgPortPtr: Pointer to the ARexx message port (V40) *)
  81.  
  82.   agaARexxPortName * = agaDummy+10;
  83.     (* E.STRPTR: Used to specify the ARexx port name (V40) (not copied) *)
  84.  
  85. TYPE
  86.  
  87.   AmigaGuideContext * = CPOINTER TO RECORD END;
  88.  
  89.   AmigaGuideMsg * = RECORD (E.Message) (* Embedded Exec message structure *)
  90.     agmType * :  E.ULONG;              (* Type of message *)
  91.     data    * :  E.APTR;               (* Pointer to message data *)
  92.     dSize   * :  E.ULONG;              (* Size of message data *)
  93.     dType   * :  E.ULONG;              (* Type of message data *)
  94.     priRet  * :  E.ULONG;              (* Primary return value *)
  95.     secRet  * :  E.ULONG;              (* Secondary return value *)
  96.     system1 * :  E.APTR;
  97.     system2 * :  E.APTR;
  98.   END;
  99.  
  100. (* Allocation description structure *)
  101.  
  102.   ContextTable * = ARRAY 32767 OF E.STRPTR;
  103.  
  104.   NewAmigaGuide * = RECORD
  105.     lock       * : D.FileLockPtr; (* Lock on the document directory *)
  106.     name       * : E.STRPTR;      (* Name of document file *)
  107.     screen     * : I.ScreenPtr;   (* Screen to place windows within *)
  108.     pubScreen  * : E.STRPTR;      (* Public screen name to open on *)
  109.     hostPort   * : E.STRPTR;      (* Application's ARexx port name *)
  110.     clientPort * : E.STRPTR;      (* Name to assign to the clients ARexx port *)
  111.     baseName   * : E.STRPTR;      (* Base name of the application *)
  112.     flags      * : SET;           (* Flags *)
  113.     context    * : ContextTablePtr; (* NULL terminated context table *)
  114.     node       * : E.STRPTR;      (* Node to align on first (defaults to Main) *)
  115.     line       * : LONGINT;       (* Line to align on *)
  116.     extens     * : U.TagListPtr;  (* Tag array extension *)
  117.     client       : E.APTR;        (* Private! MUST be NULL *)
  118.   END;
  119.  
  120. CONST
  121.  
  122. (* public Client flags *)
  123.  
  124.   loadIndex  * = 0;  (* Force load the index at init time *)
  125.   loadAll    * = 1;  (* Force load the entire database at init *)
  126.   cacheNode  * = 2;  (* Cache each node as visited *)
  127.   cacheDb    * = 3;  (* Keep the buffers around until expunge *)
  128.   unique     * = 15; (* Unique ARexx port name *)
  129.   noActivate * = 16; (* Don't activate window *)
  130.  
  131.   sysGads    * = 31;
  132.  
  133. (* Callback function ID's *)
  134.   hOpen  * = 0;
  135.   hClose * = 1;
  136.  
  137.   errNotEnoughMemory  * = 100;
  138.   errCantOpenDatabase * = 101;
  139.   errCantFindNode     * = 102;
  140.   errCantOpenNode     * = 103;
  141.   errCantOpenWindow   * = 104;
  142.   errInvalidCommand   * = 105;
  143.   errCantComplete     * = 106;
  144.   errPortClosed       * = 107;
  145.   errCantCreatePort   * = 108;
  146.   errKeywordNotFound  * = 113;
  147.  
  148. TYPE
  149.  
  150. (* Cross reference node *)
  151.   XRef * = RECORD (E.Node)   (* Embedded node *)
  152.     pad    * :  E.UWORD;     (* Padding *)
  153.     df     * :  E.APTR (*DocFilePtr*);  (* Document defined in *)
  154.     file   * :  E.STRPTR;    (* Name of document file *)
  155.     xrName * :  E.STRPTR;    (* Name of item *)
  156.     line   * :  LONGINT;     (* Line defined at *)
  157.   END;
  158.  
  159. CONST
  160.  
  161.   xrSize * = SIZE (XRef);
  162.  
  163. (* Types of cross reference nodes *)
  164.   xrGeneric  * = 0;
  165.   xrFunction * = 1;
  166.   xrCommand  * = 2;
  167.   xrInclude  * = 3;
  168.   xrMacro    * = 4;
  169.   xrStruct   * = 5;
  170.   xrField    * = 6;
  171.   xrTypedef  * = 7;
  172.   xrDefine   * = 8;
  173.  
  174. TYPE
  175.  
  176. (* Callback handle *)
  177.  
  178.   AmigaGuideHost * = RECORD (U.Hook) (* Dispatcher *)
  179.     reserved   * :  E.ULONG;         (* Must be 0 *)
  180.     flags      * :  SET;
  181.     useCnt     * :  E.ULONG;         (* Number of open nodes *)
  182.     systemData   :  E.APTR;          (* Reserved for system use *)
  183.     userData   * :  E.APTR;          (* Anything you want... *)
  184.   END;
  185.  
  186. CONST
  187.  
  188. (* Methods *)
  189.   hmFindnode  * = 1;
  190.   hmOpennode  * = 2;
  191.   hmClosenode * = 3;
  192.   hmExpunge   * = 10;  (* Expunge DataBase *)
  193.  
  194. TYPE
  195.  
  196.   Msg * = RECORD
  197.     methodID * : E.ULONG;
  198.   END;
  199.  
  200. (* hmFindnode *)
  201.   OpFindHost * = RECORD (Msg)
  202.     attrs - :  U.TagListPtr; (*  R: Additional attributes *)
  203.     node  - :  E.STRPTR;     (*  R: Name of node *)
  204.     TOC   * :  E.STRPTR;     (*  W: Table of Contents *)
  205.     title * :  E.STRPTR;     (*  W: Title to give to the node *)
  206.     next  * :  E.STRPTR;     (*  W: Next node to browse to *)
  207.     prev  * :  E.STRPTR;     (*  W: Previous node to browse to *)
  208.   END;
  209.  
  210. (* hmOpennode, hmClosenode *)
  211.   OpNodeIO * = RECORD (Msg)
  212.     attrs     - : U.TagListPtr;  (*  R: Additional attributes *)
  213.     node      - : E.STRPTR;      (*  R: Node name and arguments *)
  214.     fileName  * : E.STRPTR;      (*  W: File name buffer *)
  215.     docBuffer * : E.STRPTR;      (*  W: Node buffer *)
  216.     buffLen   * : E.ULONG;       (*  W: Size of buffer *)
  217.     flags     * : SET;           (* RW: Control flags *)
  218.   END;
  219.  
  220. CONST
  221.  
  222. (* OpNodeIO.flags *)
  223.   nKeep      * = 0;      (* Don't flush this node until database is
  224.                           * closed. *)
  225.   nReserved1 * = 1;      (* Reserved for system use *)
  226.   nReserved2 * = 2;      (* Reserved for system use *)
  227.   nAscii     * = 3;      (* Node is straight ASCII *)
  228.   nReserved3 * = 4;      (* Reserved for system use *)
  229.   nClean     * = 5;      (* Remove the node from the database *)
  230.   nDone      * = 6;      (* Done with node *)
  231.  
  232. (* OpNodeIO.attrs *)
  233.   naDummy     * = U.tagUser;
  234.   naScreen    * = naDummy+1;  (* I.ScreenPtr: Screen that window resides in *)
  235.   naPens      * = naDummy+2;  (* Pen array (from DrawInfo) *)
  236.   naRectangle * = naDummy+3;  (* Window box *)
  237.  
  238.   naHelpGroup * = naDummy+5;  (* E.ULONG: unique identifier *)
  239.  
  240. TYPE
  241.  
  242. (* hmExpunge *)
  243.   OpExpungeNode * = RECORD (Msg)
  244.     attrs - :  U.TagListPtr;  (*  R: Additional attributes *)
  245.   END;
  246.  
  247. (**-- Library Base variable --------------------------------------------*)
  248.  
  249. CONST
  250.  
  251.   name * = "amigaguide.library";
  252.  
  253. TYPE
  254.  
  255.   AmigaGuideBasePtr* = CPOINTER TO AmigaGuideBase;
  256.   AmigaGuideBase* = RECORD (E.Library) END;
  257.  
  258. VAR
  259.  
  260.   base* : AmigaGuideBasePtr;
  261.  
  262.  
  263. (**-- Library Functions ------------------------------------------------*)
  264.  
  265. (*--- functions in V40 or higher (Release 3.1) ---*)
  266.  
  267. (* Public entries *)
  268.  
  269. LIBCALL (base : AmigaGuideBasePtr) LockAmigaGuideBase  *
  270.   ( handle [8] : AmigaGuideContext )
  271.   : LONGINT;
  272.   -36;
  273. LIBCALL (base : AmigaGuideBasePtr) UnlockAmigaGuideBase  *
  274.   ( key [0] : LONGINT );
  275.   -42;
  276. LIBCALL (base : AmigaGuideBasePtr) OpenAmigaGuideA  *
  277.   ( VAR nag [8] : NewAmigaGuide;
  278.     attrs   [9] : ARRAY OF U.TagItem )
  279.   : AmigaGuideContext;
  280.   -54;
  281. LIBCALL (base : AmigaGuideBasePtr) OpenAmigaGuide  *
  282.   ( VAR nag [8]  : NewAmigaGuide;
  283.     attrs   [9]..: U.Tag )
  284.   : AmigaGuideContext;
  285.   -54;
  286. LIBCALL (base : AmigaGuideBasePtr) OpenAmigaGuideAsyncA  *
  287.   ( VAR nag [8] : NewAmigaGuide;
  288.     attrs   [0] : ARRAY OF U.TagItem )
  289.   : AmigaGuideContext;
  290.   -60;
  291. LIBCALL (base : AmigaGuideBasePtr) OpenAmigaGuideAsync  *
  292.   ( VAR nag [8]  : NewAmigaGuide;
  293.     attrs   [0]..: U.Tag )
  294.   : AmigaGuideContext;
  295.   -60;
  296. LIBCALL (base : AmigaGuideBasePtr) CloseAmigaGuide  *
  297.   ( cl [8] : AmigaGuideContext );
  298.   -66;
  299. LIBCALL (base : AmigaGuideBasePtr) AmigaGuideSignal  *
  300.   ( cl [8] : AmigaGuideContext )
  301.   : E.ULONG;
  302.   -72;
  303. LIBCALL (base : AmigaGuideBasePtr) GetAmigaGuideMsg  *
  304.   ( cl [8] : AmigaGuideContext )
  305.   : AmigaGuideMsgPtr;
  306.   -78;
  307. LIBCALL (base : AmigaGuideBasePtr) ReplyAmigaGuideMsg  *
  308.   ( amsg [8] : AmigaGuideMsgPtr );
  309.   -84;
  310. LIBCALL (base : AmigaGuideBasePtr) SetAmigaGuideContextA  *
  311.   ( cl    [8] : AmigaGuideContext;
  312.     id    [0] : E.ULONG;
  313.     attrs [1] : ARRAY OF U.TagItem )
  314.   : BOOLEAN;
  315.   -90;
  316. LIBCALL (base : AmigaGuideBasePtr) SetAmigaGuideContext  *
  317.   ( cl    [8] : AmigaGuideContext;
  318.     id    [0] : E.ULONG;
  319.     attrs [1] ..: U.Tag )
  320.   : BOOLEAN;
  321.   -90;
  322. LIBCALL (base : AmigaGuideBasePtr) SendAmigaGuideContextA  *
  323.   ( cl    [8] : AmigaGuideContext;
  324.     attrs [0] : ARRAY OF U.TagItem )
  325.   : BOOLEAN;
  326.   -96;
  327. LIBCALL (base : AmigaGuideBasePtr) SendAmigaGuideContext  *
  328.   ( cl    [8]  : AmigaGuideContext;
  329.     attrs [0]..: U.Tag )
  330.   : BOOLEAN;
  331.   -96;
  332. LIBCALL (base : AmigaGuideBasePtr) SendAmigaGuideCmdA  *
  333.   ( cl    [8] : AmigaGuideContext;
  334.     cmd   [0] : ARRAY OF CHAR;
  335.     attrs [1] : ARRAY OF U.TagItem )
  336.   : BOOLEAN;
  337.   -102;
  338. LIBCALL (base : AmigaGuideBasePtr) SendAmigaGuideCmd  *
  339.   ( cl    [8]  : AmigaGuideContext;
  340.     cmd   [0]  : ARRAY OF CHAR;
  341.     attrs [1]..: U.Tag )
  342.   : BOOLEAN;
  343.   -102;
  344. LIBCALL (base : AmigaGuideBasePtr) SetAmigaGuideAttrsA  *
  345.   ( cl    [8] : AmigaGuideContext;
  346.     attrs [9] : ARRAY OF U.TagItem )
  347.   : LONGINT;
  348.   -108;
  349. LIBCALL (base : AmigaGuideBasePtr) SetAmigaGuideAttrs  *
  350.   ( cl    [8]  : AmigaGuideContext;
  351.     attrs [9]..: U.Tag )
  352.   : LONGINT;
  353.   -108;
  354. LIBCALL (base : AmigaGuideBasePtr) GetAmigaGuideAttr  *
  355.   ( tag         [0] : U.Tag;
  356.     cl          [8] : AmigaGuideContext;
  357.     VAR storage [9] : ARRAY OF SYS.BYTE )
  358.   : LONGINT;
  359.   -114;
  360. LIBCALL (base : AmigaGuideBasePtr) LoadXRef  *
  361.   ( lock [8] : D.FileLockPtr;
  362.     name [9] : ARRAY OF CHAR )
  363.   : LONGINT;
  364.   -126;
  365. LIBCALL (base : AmigaGuideBasePtr) ExpungeXRef  * ();
  366.   -132;
  367. LIBCALL (base : AmigaGuideBasePtr) AddAmigaGuideHostA  *
  368.   ( h     [8] : U.HookPtr;
  369.     name  [0] : ARRAY OF CHAR;
  370.     attrs [9] : ARRAY OF U.TagItem )
  371.   : AmigaGuideHostPtr;
  372.   -138;
  373. LIBCALL (base : AmigaGuideBasePtr) AddAmigaGuideHost  *
  374.   ( h     [8]  : U.HookPtr;
  375.     name  [0]  : ARRAY OF CHAR;
  376.     attrs [9]..: U.Tag )
  377.   : AmigaGuideHostPtr;
  378.   -138;
  379. LIBCALL (base : AmigaGuideBasePtr) RemoveAmigaGuideHostA  *
  380.   ( hh    [8] : AmigaGuideHostPtr;
  381.     attrs [9] : ARRAY OF U.TagItem )
  382.   : LONGINT;
  383.   -144;
  384. LIBCALL (base : AmigaGuideBasePtr) RemoveAmigaGuideHost  *
  385.   ( hh    [8]  : AmigaGuideHostPtr;
  386.     attrs [9]..: U.Tag )
  387.   : LONGINT;
  388.   -144;
  389. LIBCALL (base : AmigaGuideBasePtr) GetAmigaGuideString  *
  390.   ( id [0] : LONGINT )
  391.   : E.STRPTR;
  392.   -210;
  393.  
  394. (**-- Library Base variable --------------------------------------------*)
  395.  
  396. (**-----------------------------------*)
  397. PROCEDURE* CloseLib ();
  398.  
  399. BEGIN (* CloseLib *)
  400.   IF base # NIL THEN E.base.CloseLibrary (base) END
  401. END CloseLib;
  402.  
  403. (**-----------------------------------*)
  404. PROCEDURE OpenLib * (mustOpen : BOOLEAN );
  405.  
  406. BEGIN (* OpenLib *)
  407.   IF base = NIL THEN
  408.     base :=
  409.       SYS.VAL (
  410.         AmigaGuideBasePtr,
  411.         E.base.OpenLibrary (name, E.libraryMinimum));
  412.     IF base # NIL THEN SYS.SETCLEANUP (CloseLib)
  413.     ELSIF mustOpen THEN HALT (100)
  414.     END;
  415.   END;
  416. END OpenLib;
  417.  
  418. BEGIN
  419.   base := NIL
  420. END AmigaGuide.
  421.